Function: doc-view-doc->txt

doc-view-doc->txt is a byte-compiled function defined in doc-view.el.gz.

Signature

(doc-view-doc->txt TXT CALLBACK)

Documentation

Convert the current document to text and call CALLBACK when done.

Source Code

;; Defined in /usr/src/emacs/lisp/doc-view.el.gz
(defun doc-view-doc->txt (txt callback)
  "Convert the current document to text and call CALLBACK when done."
  (make-directory (doc-view--current-cache-dir) t)
  (pcase doc-view-doc-type
    ('pdf
     ;; Doc is a PDF, so convert it to TXT
     (doc-view-pdf->txt doc-view--buffer-file-name txt callback))
    ('ps
     ;; Doc is a PS, so convert it to PDF (which will be converted to
     ;; TXT thereafter).
     (let ((pdf (doc-view-current-cache-doc-pdf)))
       (doc-view-ps->pdf doc-view--buffer-file-name pdf
                         (lambda () (doc-view-pdf->txt pdf txt callback)))))
    ('dvi
     ;; Doc is a DVI.  This means that a doc.pdf already exists in its
     ;; cache subdirectory.
     (doc-view-pdf->txt (doc-view-current-cache-doc-pdf) txt callback))
    ('odf
     ;; Doc is some ODF (or MS Office) doc.  This means that a doc.pdf
     ;; already exists in its cache subdirectory.
     (doc-view-pdf->txt (doc-view-current-cache-doc-pdf) txt callback))
    (_ (error "DocView doesn't know what to do"))))